package com.tc.socket.mq;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.jms.Queue;

/**
 * @Auther: tianchao
 * @Date: 2022/2/23 14:26
 * @Description:
 */
@Configuration
public class BeanConfig {
    //定义存放消息的队列
    @Bean(name = "testQueue")
    public Queue queue() {
        return new ActiveMQQueue("tianchao3.ActiveMQQueue");
    }
//    public ConnectionFactory connectionFactory(){
//
//        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
//        connectionFactory.setBrokerURL("tcp://localhost:61616");
//        connectionFactory.setUserName("admin");
//        connectionFactory.setPassword("admin");
//        return connectionFactory;
//
//    }
//    @Bean
//    public DefaultJmsListenerContainerFactory jmsTopicListenerContainerFactory() {
//
//        DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
//
//        factory.setConnectionFactory(connectionFactory());
//        //true为topic，false为queue
//        factory.setPubSubDomain(true);
////        factory.setConcurrency("3-10");
//        factory.setRecoveryInterval(1000L);
//        return factory;
//    }
}
